Share via


Application Class [IIS 7 and higher]

Represents an IIS Web application.

Syntax

class Application : ConfiguredObject

Methods

The following table lists the methods exposed by the Application class.

Name

Description

Create

Creates a Web application.

GetSection

(Inherited from ConfiguredObject.)

GetAllSections

(Inherited from ConfiguredObject.)

RevertToParent

Reverts an application's configuration value or values to the default.

Properties

The following table lists the properties exposed by the Application class.

Name

Description

ApplicationPool

A read/write string value that specifies a case-sensitive name for the application pool for an application. The default is "DefaultAppPool".

EnabledProtocols

A read/write string array that specifies the protocols that requests can use to access an application. A value of either "HTTP" or "HTTPS" enables both HTTP and HTTPS. If neither "HTTP" nor "HTTPS" is specified, neither is enabled for the application. The default is "HTTP". To accept only HTTPS requests, configure the Secure Sockets Layer (SSL) feature for the site.

Path

A read-only string value that specifies the virtual path of the application after the host header. For example, if you have an application at http://www.alpineskihouse.com/Skis/Downhill, the Path property is /Skis/Downhill. A key property.

SiteName

A read-only string value that specifies the unique name of the Web site. A key property.

VirtualDirectoryDefaults

A VirtualDirectoryElementDefaults object whose read/write properties specify default values for virtual directories under the application.

Subclasses

This class contains no subclasses.

Remarks

A Web application is a grouping of content at the root level of a Web site or a grouping of content in a separate folder below the Web site's root directory. The Application class enables you to specify properties specific to a particular application, such as the application pool that the application will run in.

Example

The following example assigns the Northwind application to an application pool named NewAppPool.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Retrieve the application and display its Web site name and path.
Set oApp = oWebAdmin.Get(_ 
"Application.SiteName='Default Web Site',Path='/Northwind'")
WScript.Echo "Web site and path: '" & oApp.SiteName & oApp.Path & "'"
WScript.Echo "Old application pool: " & oApp. ApplicationPool

' Specify a new application pool name and save it.
' Note that the name is case-sensitive.
oApp.ApplicationPool = "NewAppPool"
oApp.Put_

' Display the new application pool name.
WScript.Echo "New application pool: " & oApp.ApplicationPool

Note

The name of the application pool is case-sensitive.

IIS does not verify whether the specified application pool actually exists. If the application pool does not exist, the user receives an HTTP error 403.18 with the message "The specified request cannot be executed in the application pool that is configured for this resource on the Web server."

To set the default application pool for all the applications in a Web site, use the ApplicationDefaults property of the Site class.

Inheritance Hierarchy

ConfiguredObject

   Application

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

ApplicationElementDefaults Class [IIS 7 and higher]

ConfiguredObject Class [IIS 7 and higher]

Site Class [IIS 7 and higher]

VirtualDirectoryElementDefaults Class [IIS 7 and higher]